home *** CD-ROM | disk | FTP | other *** search
- /*
- GEQDWinDIB.H
-
- Graphic Elements Windows compatibility module.
-
- Copyright 1997 by Al Evans. All rights reserved.
-
- 2/12/97
-
- NOTE:
-
- This version of Graphic Elements for Windows 95 uses the Microsoft
- CreateDIBSection() graphics interface.
-
-
- */
-
- #ifndef GEQDWIN
-
- #define GEQDWIN
-
-
-
- #ifdef __cplusplus
-
- extern "C" {
-
- #endif
-
-
- // Windows utility function to create identity palette
-
- HPALETTE Make256IdentityPalette(PALETTEENTRY *colors);
- // Analogs of Mac QuickDraw entities and calls for Windows 95 version
-
-
- typedef RECT Rect;
- typedef HRGN RgnHandle;
-
- // Define a Point which can be accessed using either Mac (h, v) or
- // Windows 95 (x, y) naming conventions.
-
- typedef struct { union { POINT WinPoint;
- struct { long h; long v; };
- };
- } Point;
-
- typedef enum {v, h} VHSelect;
-
- // Can't use equivalent Windows SRCCOPY etc. because we count on copy modes being < 14 bits
-
- #define srcCopy 0
- #define srcOr 1
- #define transparent 2
-
- // Mac-compatible text styles
-
- #define normal 0
- #define bold 1
- #define italic 2
- #define underline 4
- #define outline 8
- #define shadow 16
- #define condense 32
- #define extend 64
-
- typedef TEXTMETRIC FontInfo;
-
- struct BMInfoWinPalette {
- BITMAPINFOHEADER bmiHeader;
- USHORT bmiIndex[256];
- };
-
- typedef struct BMInfoWinPalette BMInfoWinPalette;
-
- struct BitMap {
- BMInfoWinPalette bmInfo;
- HBITMAP bmMap;
- void* bmBits;
- };
-
- typedef struct BitMap BitMap;
-
-
- // Should be changed to take BitMap* !!!!
- typedef struct GWorld {
- Rect portRect;
- HWND portWindow;
- BitMap portBits;
- } GWorld, *GWorldPtr;
-
- // As used in Graphic Elements, these are all equivalent
- typedef GWorldPtr GrafPtr;
- typedef GWorldPtr CGrafPtr;
-
- // Ugly, but usage is the same
- typedef BitMap* PixMapHandle;
-
-
- // Mac-compatible RGBColor
- typedef struct RGBColor {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- } RGBColor;
-
- typedef FOURCC OSType;
-
- typedef HWND GDHandle; // ????
- typedef HPALETTE CTabHandle;
- typedef long Fixed;
-
- typedef long OSErr; // ????
-
- // Identity palette creation utility
- HPALETTE Make256IdentityPalette(PALETTEENTRY *colors);
-
-
- OSErr NewGWorld( GWorldPtr *offscreenGWorld,
- short offscrnDepth,
- Rect *boundsRect,
- CTabHandle worldColors, GDHandle aGDevice, unsigned long flags);
-
- void DisposeGWorld(GWorldPtr world);
- void DisposCTable(CTabHandle cTable);
-
- void GetPort (GrafPtr * savePort);
-
- // Get rid of #define in WINSPOOL.H
- #ifdef SetPort
- #undef SetPort
- #endif
-
-
- void SetPort (GrafPtr newPort);
- void SetOrigin(short h, short v);
- void InvalRect(Rect * invalRect); // causes repaint
-
-
- #define NewRgn() CreateRectRgn(0,0,1,1)
-
- void RectRgn(RgnHandle region, Rect *newRect);
- void DisposeRgn(RgnHandle rgn);
-
- // Get rid of definition in WINDOWSX.H
- #ifdef CopyRgn
- #undef CopyRgn
- #endif
-
- void CopyRgn(RgnHandle source, RgnHandle dest);
-
- #define OffsetRgn(r,dh,dv) OffsetRgn((HRGN)r,dh,dv)
-
- void SectRgn(RgnHandle a, RgnHandle b, RgnHandle result);
- void DiffRgn(RgnHandle a, RgnHandle b, RgnHandle result);
-
- // Get rid of definition in WINDOWSX.H
- #ifdef UnionRgn
- #undef UnionRgn
- #endif
-
- void UnionRgn(RgnHandle a, RgnHandle b, RgnHandle result);
-
- #define PtInRgn(pt,rgn) PtInRegion((HRGN)rgn,(pt).h,(pt).v)
- #define PtInRect(pt,rect) PtInRect(rect,(pt).WinPoint)
-
- void GetGWorld(CGrafPtr *port, GDHandle *gdh);
- void SetGWorld(CGrafPtr port, GDHandle gdh);
- PixMapHandle GetGWorldPixMap(GWorldPtr world);
-
-
- // Used only in TextGE
- void ClipRect(Rect *);
-
-
- void GlobalToLocal(Point * p);
-
- // Irrelevant for Windows 95 version
- #define LockPixels(PixMapHandle) ((Boolean) true)
- #define NoPurgePixels(PixMapHandle)
- #define UnlockPixels
-
- void EraseRect(Rect * r);
- void InsetRect( Rect*, short h, short v );
-
-
- GE_CALLBACK(void,CopyBits)(const BitMap *srcBits, const BitMap *dstBits,
- const Rect *srcRect, const Rect *dstRect, short mode, RgnHandle maskRgn);
-
- #define FastCopyBits QuickCopyBits
-
- #ifdef __cplusplus
-
- }
-
- #endif
-
-
-
- #endif
-
-
-
-